package hacker_rank;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;

public class TwoArrays {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int T = Integer.parseInt(br.readLine());
		String[] res = new String[T];

		TwoArrays ta = new TwoArrays();
		for (int t = 0; t < T; t++) {
			String line = br.readLine();
			String[] tmp = line.split(" ");

			int N = Integer.parseInt(tmp[0]);
			int K = Integer.parseInt(tmp[1]);

			Integer A[] = new Integer[N];
			Integer B[] = new Integer[N];

			line = br.readLine();
			tmp = line.split(" ");

			for (int i = 0; i < N; i++) {
				A[i] = Integer.parseInt(tmp[i]);
			}

			line = br.readLine();
			tmp = line.split(" ");

			for (int i = 0; i < N; i++) {
				B[i] = Integer.parseInt(tmp[i]);
			}

			res[t] = ta.solve(A, B, K);

		}

		for (String s : res)
			System.out.println(s);
	}

	private String solve(Integer[] A, Integer[] B, int k) {
		Arrays.sort(A);
		Arrays.sort(B, Collections.reverseOrder());
		
		int n = A.length;
		
		for (int i = 0; i < n; i++) {
			if (A[i] + B[i] < k) {
				return "NO";
			}
		}
		return "YES";

	}
}
